#include <bits/stdc++.h>
using namespace std;
int a[10000];
int main()
{
    int n, m, p, q;
    cin >> n >> m >> p >> q;
    for (int i = 1; i <= n * m; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= p * q; i++)
    {
        cout << a[i] << " ";
        if (i % q == 0)
        {
            cout << endl;
        }
    }
}